
*use "/Users/scottmorgenstern/Library/CloudStorage/OneDrive-UniversityofPittsburgh/_LA elite survey PELA (Salamanca)/_annual survey versions/2010/BASEDATOS_BRASIL_102 2014.dta
import spss using "D:/OneDrive - University of Pittsburgh/Pela project/PELA DATA/BASEDATOS_BRASIL_102.sav", clear

gen N_Estudo=102
gen Per_leg=2011-14

keep Per_leg partido N_Estudo  EM1 p29 p30  ID1 ID2 RE1 RE1a SOCD4 SOCD5 SOCD7 ///
 VAL1 VAL2 VAL3 VAL4 VAL5 VAL6




save  "/Users/scottmorgenstern/Library/CloudStorage/OneDrive-UniversityofPittsburgh/_LA elite survey PELA (Salamanca)/Pitt projects/_PELA 2022/consolidated surveys/Brazil2011to2014" , replace


gen country="Brazil"
gen pais="Brazil"

*label variable IMP1a "IMP1a impostos diretos/indiretos "
label variable partido "partido"
label variable SOCD4 "SOCD4 sexo"
label variable EM1 "p28 EM1 regulacion de la economia" 
label variable p29 "p29 PRIV1 State control of public services"
label variable p30 "p30 PRIV2 state control of natural resources"
label variable ID1 "p64 ID1 ideology"

/*
label variable ROES1_a "ROES1_a state ownership of business"
label variable ROES1_b "ROES1_b state as responsible for well being"
label variable ROES1_c "ROES1_c state as responsible job creation"
label variable ROES1_d "ROES1_d state as responsible inequality"
label variable ROES1_e "ROES1_e state as responsible for pensions"
label variable ROES1_f "ROES1_f state as responsible for health care"
label variable ROES1_g "state as responsible for university education" 
label variable GP1_1 "GP1_1 spend more on what?"
label variable GP1_2 "GP1_2 spend more on what else?"
*/

label variable VAL2 "VAL1 Same sex marriage"
label variable VAL6 "VAL2 abortion"
label variable VAL4 "drug use"
label variable VAL3 "death penalty"
label variable VAL5 "guns legal"
label variable VAL1 "legal age"


label variable RE1 "p66 RE1   Es ud adepto a alguna religion?"
* Brazil asks ¿Es adepto de alguna religión? while other countries asy es ud creyente
label variable RE1a "p67 RE1a   ¿Cuál es su religión?"

* no vasraible similar to  RE1b "RE1b religion frequency"

gen female=0
replace female=1 if SOCD4==2



rename N_Estudo nestu
gen date=2014
*rename IMP1a eco_tax
rename SOCD4 sex
rename EM1 eco_regulated
*rename RE1a religious
rename RE1 religious
replace religious=. if RE1>2
* again, mote Brazil uses different question (adepto)


/* rename ROES1_a eco_education_p
rename ROES1_b eco_wellbeing
rename ROES1_c eco_employment
rename ROES1_d eco_inequality
rename ROES1_e eco_pensions
rename ROES1_f eco_health
rename ROES1_g eco_education_u
*/ 

rename  p29 eco_services
rename  p30 eco_natural
*rename  GP1_1 state_spend
*rename  GP1_2 state_spend2
rename  VAL2 val_ssm
rename  VAL6 val_abortion

rename SOCD7 education
rename SOCD5 age

*gen regular_church=0
* <no variable for this survey; replace regular_church=1 if RE1b==3 | RE1b==4 | RE1b==5

* rename RE1b church_attend

gen rel_catholic=0
replace rel_catholic=1 if RE1a==1

gen rel_evangelical=0
replace rel_evangelical=1 if RE1a==3
* Valentina adds "if religious==1"


gen rel_other=.



 
*val_abortion is 1-10 wiuth 1=against; in 2003 survey it was reversed  
gen abort_rescale=.
replace abort_rescale=10 if val_abortion==1
replace abort_rescale=9 if val_abortion==2
replace abort_rescale=8 if val_abortion==3
replace abort_rescale=7 if val_abortion==4
replace abort_rescale=6 if val_abortion==5
replace abort_rescale=5 if val_abortion==6
replace abort_rescale=4 if val_abortion==7
replace abort_rescale=3 if val_abortion==8
replace abort_rescale=2 if val_abortion==9
replace abort_rescale=1 if val_abortion==10

replace val_abortion=abort_rescale


lab define val_abortion_reverse ///
	1 "Totally against" ///
	10 "Totally agree"
lab val val_abortion val_abortion_reverse







gen partylab=""
replace partylab="BR PP" if partido==492
replace partylab="BR PDT" if partido==493
replace partylab="BR PT" if partido==494
replace partylab="BR PTB" if partido==495
replace partylab="BR PMDB" if partido==496
replace partylab="BR PSC" if partido==497
replace partylab="BR PR" if partido==498
replace partylab="BR PPS" if partido==499
replace partylab="BR DEM" if partido==500
replace partylab="BR PSB" if partido==501
replace partylab="BR PV" if partido==502
replace partylab="BR PSDB" if partido==503
replace partylab="BR PCdoB" if partido==504
replace partylab="BR PRB" if partido==509
replace partylab="BR PROS" if partido==510
replace partylab="BR SDD" if partido==511
replace partylab="BR Others" if partido==530

gen party=partylab
drop partido
gen partido=partylab

save "/Users/scottmorgenstern/Library/CloudStorage/OneDrive-UniversityofPittsburgh/_LA elite survey PELA (Salamanca)/Pitt projects/_PELA 2022/consolidated surveys/Brazil2011to2014", replace

